server {
    listen 80;
    server_name www.besteasylearn.com;

    lua_code_cache off;

    location /socket_test {
        alias /opt/andrew_git/wss/;
        index index.html;
     }

    location /adminplat {

        if ($request_uri ~* "^/adminplat/(.*)\?(.*)$") {
            set $version $2;
            set $beforePath $1;
            rewrite .* /adminplat/index.html/#/beforePath?/$version? last; 
        }

        alias /opt/judo_git/communityAdminWeb/app/dist_01/;
        index  index.html;
    }

    location /adminshop {

        if ($request_uri ~* "^/adminshop/(.*)\?(.*)$") {
            set $version $2;
            set $beforePath $1;
            rewrite .* /adminshop/index.html/#/beforePath?/$version? last; 
        }

        alias /opt/judo_git/communityAdminWeb/app/dist_02/;
        index  index.html;
    }

    location /admingarden {

        if ($request_uri ~* "^/admingarden/(.*)\?(.*)$") {
            set $version $2;
            set $beforePath $1;
            rewrite .* /admingarden/index.html/#/beforePath?/$version? last; 
        }

        alias /opt/judo_git/communityAdminWeb/app/dist_03/;
        index  index.html;
    }

    location /apiplat/ {
        proxy_pass http://47.103.36.143:31001/;
    }

    location /apimanage/ {
        proxy_pass http://47.103.36.143:31002/;
    }


    location /wechat/ {
        alias /opt/andrew_git/wechat_demo/chat/dist/;
        index  index.html;
    }

    location /entry {
        alias /opt/modules/openresty/nginx/html;
    }

    location /kang/ {
        alias /opt/andrew_git/material_h5/app/;
    }
    
    location /Drawing/ {
        alias /opt/andrew_git/DrawingBoard/;
    }


    location /teach_web/ {
        alias /opt/andrew_git/teach_app/web/dist/;
    }

    location /teach_api/ {

        proxy_pass http://223.68.159.69:1001/api/;

        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers X-Requested-With;
        add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
    }

    location /pic/ {
        alias /opt/pic/;
        index  1.jpg;
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers X-Requested-With;
        add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

    }

    location /hw/ {
        alias /opt/andrew_git/handerWritingWeb/;
    }

    location /room_3d/ {
        alias /opt/andrew_git/room_3d/dist/;
        index  index.html;
    }

    location /web/ {
        alias /opt/andrew_git/static_web/;
        index  index.html;
    }

    location / {
        default_type 'text/plain';
        content_by_lua_block {
           ngx.say('hello openresty-lua');
        }
    }

    

}
